<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://xmlns.jcp.org/jsf/passthrough"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value=" #{messages.Wrong} #{messages.Question}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:outputScript library="javaScript" name="remoteMathJax.js" target="head"/>
            <h:form styleClass="jsfcrud_list_form" id="form1">
                <h:panelGrid rendered="#{roleinfoController.teacher}" columns="2">
                    <h:outputLabel value="#{messages.School}"/>
                    <h:selectOneMenu value="#{schoolController.selected}" 
                                     requiredMessage="#{messages.Select}#{messages.School}" immediate="true" required="true">
                        <f:selectItem itemLabel="#{messages.Please}#{messages.Select}"  itemValue="null"/>
                        <f:selectItems value="#{schoolController.getSchools4Teacher(teacherAdminController.logined)}"/>
                        <f:ajax render="subject"/>
                    </h:selectOneMenu> 
                </h:panelGrid>

                <h:panelGrid rendered="#{roleinfoController.parent}" columns="2">
                    <h:outputLabel value="#{messages.Student}"/>
                    <h:selectOneMenu value="#{studentController.selected}" 
                                     requiredMessage="#{messages.Select}#{messages.Student}" immediate="true" required="true">
                        <f:selectItem itemLabel="#{messages.Please}#{messages.Select}"  itemValue="null"/>
                        <f:selectItems value="#{parentController.selected.students}"/>
                        <f:ajax render="subject"/>
                    </h:selectOneMenu> 
                </h:panelGrid>

                <h:panelGrid columns="2"  id="subject">
                    <h:outputLabel value="#{messages.Subject}"/>
                    <h:selectOneMenu value="#{subjectController.selected}"
                                     requiredMessage="#{messages.Select}#{messages.Subject}" immediate="true" required="true">
                        <f:selectItem itemLabel="#{messages.Please}#{messages.Select}"  itemValue="null"/>
                        <f:selectItems value="#{subjectController.getSubject4TeacherOrStudent(teacherAdminController.logined,studentController.selected)}"/>
                        <f:ajax render="knowledge"/>
                    </h:selectOneMenu>
                </h:panelGrid>
                <hr/>

                <h:panelGroup id="knowledge">
                    <h:outputLabel value="#{wrongquestionCollectionController.wrongQuestionInformation}" />
                    <h:panelGrid columns="1" rendered="#{!subjectController.selectedNull}">
                        <c:forEach items="#{wrongquestionCollectionController.wrongQuestionCollectionList}" var="item">
                            <!--题干-->
                            <h:outputText escape="false"   value="#{item.questionId.valueinfo}"/>
                            <h:outputLabel value="#{messages.Answer}:"/>
                            <!--显示答案-->
                            <c:if test="#{questionControllerA.isSingleFill(item.questionId.type)}" >
                                <h:outputLabel  value="#{item.questionId.answer}"/>
                            </c:if>
                            <c:if test="#{questionControllerA.isJudgment(item.questionId.type)}" >
                                <h:selectOneRadio  value="#{item.questionId.answer}" readonly="true" layout="pageDirection">
                                    <f:selectItem itemLabel="#{messages.True}" itemValue="T"/>
                                    <f:selectItem itemLabel="#{messages.False}" itemValue="F"/>
                                </h:selectOneRadio>
                            </c:if>
                            <c:if test="#{questionControllerA.isSingleSelection(item.questionId.type)}" >
                                <h:selectOneRadio  value="#{item.questionId.answer}" readonly="true" layout="pageDirection">
                                    <f:selectItem itemLabel="A.#{item.questionId.secondContenItems.split('\\$#')[0]}" itemValue="1"/>
                                    <f:selectItem itemLabel="B.#{item.questionId.secondContenItems.split('\\$#')[1]}" itemValue="2"/>
                                    <f:selectItem itemLabel="C.#{item.questionId.secondContenItems.split('\\$#')[2]}" itemValue="3"/>
                                    <f:selectItem itemLabel="D.#{item.questionId.secondContenItems.split('\\$#')[3]}" itemValue="4"/>  
                                </h:selectOneRadio>

                            </c:if>
                            <c:if test="#{questionControllerA.isMultiSelection(item.questionId.type)}" >
                                <h:selectManyCheckbox  value="#{item.questionId.answer}" readonly="true" layout="pageDirection">
                                    <f:selectItem itemLabel="A.#{item.questionId.secondContenItems.split('\\$#')[0]}" itemValue="1"/>
                                    <f:selectItem itemLabel="B.#{item.questionId.secondContenItems.split('\\$#')[1]}" itemValue="2"/>
                                    <f:selectItem itemLabel="C.#{item.questionId.secondContenItems.split('\\$#')[2]}" itemValue="3"/>
                                    <f:selectItem itemLabel="D.#{item.questionId.secondContenItems.split('\\$#')[3]}" itemValue="4"/>  
                                </h:selectManyCheckbox>
                            </c:if>
                            <c:if test="#{questionControllerA.isSimpleAnswer(item.questionId.type)}" >
                                <h:outputText escape="false"  value="#{item.questionId.answer}"/>
                            </c:if>
                            <h:panelGrid columns="2">
                                <h:outputLabel value="#{messages.Reference}#{messages.Answer}:"/>
                                <h:outputText escape="false"  value="#{questionControllerA.getShownQuestionAnswer(item.questionId)}"/>
                                <h:outputLabel  value="#{messages.Analysis}:"/>
                                <h:outputText escape="false"   value="#{item.questionId.analysis}"/>
                                <h:outputLabel value="#{messages.Belong}:"/>
                                <h:outputText escape="false"   value="#{item.questionId.knowledgeId.name}"/>
                                <h:outputLabel value="#{messages.Detail}"/>
                                <h:outputText escape="false"   value="#{item.questionId.knowledgeId.details}"  p:id="myeditor"/>
                            </h:panelGrid>
                            <hr/>
                        </c:forEach>
                    </h:panelGrid>
                </h:panelGroup>
            </h:form>
        </ui:define>
    </ui:composition>

</html>

